import { createRouter, createWebHistory } from "vue-router";
import HomeView from "../views/HomeView.vue";
const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: "/",
      redirect: "home",
    },
    {
      path: "/home",
      name: "home",
      component: HomeView,
      meta: { requiresAuth: true },
    },
    {
      path: "/classify",
      name: "classify",
      component: () => import("../views/ClassifyView.vue"),
      meta: { requiresAuth: true },
    },
    {
      path: "/shopping",
      name: "shopping",
      component: () => import("../views/ShoppingView.vue"),
      meta: { requiresAuth: true },
    },
    {
      path: "/mine",
      name: "mine",
      component: () => import("../views/MineView.vue"),
      meta: { requiresAuth: true },
    },
    {
      path: "/goods/ppszg",
      name: "List",
      component: () => import("@/views/goods/List.vue"),
    },
    {
      path: "/goods/detail",
      name: "GoodsDetail",
      component: () => import("@/views/goods/GoodsDetail.vue"),
    },
    {
      path: "/goods/topic",
      name: "topicDetail",
      component: () => import("@/views/goods/GoodsDatail2.vue"),
    },
    {
      path: "/login",
      name: "Login",
      component: () => import("@/views/Login.vue"),
    },
    {
      path: "/goods/list",
      name: "GoodsListView",
      component: () => import("@/views/goods/GoodsListView.vue"),
    },
    {
      path: "/goods/morexpsf",
      name: "morexptj",
      component: () => import("@/views/more/morexptj.vue"),
    },
    {
      path: "/goods/moreppszg",
      name: "moreppszg",
      component: () => import("@/views/more/moreppszg.vue"),
    },
    {
      path: "/goods/morehot",
      name: "morehot",
      component: () => import("@/views/more/morehot.vue"),
    },
    {
      path: "/goods/moreztjx",
      name: "moreztjx",
      component: () => import("@/views/more/moreztjx.vue"),
    },
    {
      path: "/checkout",
      name: "Checkout",
      component: () => import("@/views/Checkout.vue"),
      meta: { requiresAuth: true },
    },
    {
      path: "/address",
      name: "address",
      component: () => import("@/views/Address.vue"),
      meta: { requiresAuth: true },
    },
    {
      path: "/address/edit",
      component: () => import("@/views/AddressEdit.vue"),
      props: (route) => ({ id: route.query.id }),
    },
     {
      path: "/order/success",
      component: () => import("@/views/Order.vue"),
    },
  ],
});

export default router;
